package BJava2月.B综合练习;

public class F数字加密 {
    public static void main(String[] args) {

     


        //1,把整数里面的每一位放到数组当中
        int [] arr = {1,9,8,3};
        
        //2，加密
        //每位数+5
        for (int i = 0; i < arr.length; i++) {
            arr[i] = arr[i] + 5;
        }

        //再对10求余
        for (int i = 0; i < arr.length; i++) {
            arr[i] = arr[i] % 10;
        }

        //将所有数字进行反转
        for (int i = 0, j = arr.length - 1; i< j; i++, j--){
            int temp = arr[i];
            arr[i] = arr[j];
            arr[j] = temp;
        }


        for (int i = 0; i < arr.length; i++) {
        System.out.print(arr[i] + " ");
        }
        //8 3 4 6 - --> 8346
        //3，把数组里面的每一个数字进行拼接，变成加密之后的结果
        int number = 0;

        for (int i = 0; i < arr.length; i++) {
            number = number*10 + arr[i];
        }
        System.out.println(number);
    }
    }
